'''
Author: duliang thinktanker@163.com
Date: 2024-07-28 14:52:21
LastEditors: duliang thinktanker@163.com
LastEditTime: 2024-07-28 17:14:46
FilePath: \control-net\controlpro.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
# from pywinauto.application import Application
# import time

# # 连接到正在运行的应用程序
# app = Application(backend='uia').connect(title='文字识别.bat')  # 替换为实际的控制台标题

# # 等待一段时间以确保控制台已经完全加载
# time.sleep(1)

# # 获取控制台窗口
# console_window = app.window(title='文字识别.bat')  # 替换为实际的控制台标题

# # 读取窗口中的文本
# text = console_window.window(
#     auto_id='console_output').get_text()  # 替换"console_output"为实际的控件ID
# print(text)
import subprocess

process = subprocess.Popen([r'D:\myGitee\dul_xxqg\watchRDNIS.bat'],
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
with open('./output.txt', 'w') as f:
    f.write(stdout.decode())
    f.write(stderr.decode())
